<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css"/>
	</head>
	<body>
	<div class="am-g">
		 {include file='../Common/hy_header.html'}
		 {$time}
		 <div class="am-g">
			<br>
			
			<div class="am-u-md-8 am-u-end">
				<form class="am-form am-form-horizontal hy-js-form">
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">规则名</label>
						<div class="am-u-sm-6">
							<input type="text" name="rule_name" value="{$rule.rule_name}" placeholder="">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">类型</label>
						<div class="am-u-sm-6">
							<div class="am-btn-group hy-js-menutab" data-am-button="">
									<label data-target='#link1' class="hy-js-menubtn am-btn am-btn-default am-btn-xs {if $rule.status}{if $rule.status eq 1}am-active {else}{/if}{else}am-active {/if}">
										<input type="radio" {if $rule.status}{if $rule.status eq 1}checked="checked" {else}{/if}{else}checked="checked" {/if} name="status" value="1" id="option1">时间规则
									</label>
									<label data-target='#link2' class="hy-js-menubtn am-btn am-btn-default am-btn-xs{if $rule.status eq 2} am-active {else}{/if}">
										<input type="radio" name="status" {if $rule.status eq 2}checked="checked" {else}{/if} value="2" id="option2"> 评论规则
									</label>
									<label data-target='#link3' class="hy-js-menubtn am-btn am-btn-default am-btn-xs{if $rule.status eq 3} am-active {else}{/if} lay_date_s1">
										<input type="radio" name="status" {if $rule.status eq 3}checked="checked" {else}{/if} value="3" id="option2"> 每日时间规则
									</label>
									<label data-target='#link3' class="hy-js-menubtn am-btn am-btn-default am-btn-xs{if $rule.status eq 4} am-active {else}{/if} lay_date_s2">
										<input type="radio" name="status" {if $rule.status eq 4}checked="checked" {else}{/if} value="4" id="option2"> 单日时间规则
									</label>
								</div>
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					
					
					<div id='link1' {if $rule.status}{if $rule.status eq 1}style='display: block;'{else}{/if}{else}style='display: block;'{/if}  class="am-form-group am-g am-margin-top hy-js-menupanel hy-hide">
						<label for="user-name" class="am-u-sm-3 am-form-label">	时间（秒）</label>
						<div class="am-u-sm-6">
							<input type="text" id="showtime" name="showtime" {if $rule.status eq 1} value="{$rule.showtime}" {else} value="0"{/if} >
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div id='link2' {if $rule.status eq 2}style='display: block;'{/if} class="am-form-group am-g am-margin-top hy-js-menupanel hy-hide">
						<label for="user-name" class="am-u-sm-3 am-form-label">	评论条数</label>
						<div class="am-u-sm-6">
							<input type="text" id="comment_num" name="comment_num" {if $rule.status eq 2} value="{$rule.comment_num}" {else} value="0"{/if}>
						</div>
						<div class="am-u-sm-3">
						</div>
					</div >
					<div id='link3'  {if $rule.status eq 3}style='display: block;'{/if} class="am-form-group am-g am-margin-top hy-js-menupanel hy-hide">
						<label for="user-name" class="am-u-sm-3 am-form-label">	具体时间</label>
						<div class="am-u-sm-3">
							<input type="text" id="specific_time" name="specific_time" {if $rule.status eq 3||$rule.status eq 4} value="{$rule.specific_time|date_format:'Y-m-d H:i:s'}" {else} value="" {/if}>
						</div>
						<label for="user-name" class="am-u-sm-3 am-form-label">	次数（默认为1）</label>
						<div class="am-u-sm-3">
							<input type="text" id="time" name="time" {if $rule.status eq 3||$rule.status eq 4} value="{$rule.time}" {else} value="" {/if}>
							
						</div>
					</div>
						
						
					</div>
					
					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							<input type="hidden" name="id" value="{$id}">
							<input type="hidden" name="sid" value="{$sid}">
							<button type="button" class="am-btn am-btn-primary hy-js-submit">{$_L.SAVE}</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	  {include file='../Common/hy_footer.html'}
	<script type="text/javascript" src="{$_C.hy_path}js/editor/kindeditor.js"></script>
	<script type="text/javascript" src="{$_C.hy_path}js/laydate/laydate.js"></script>
	<script type="text/javascript">
		$(function(){
			laydate({
			   elem: '#specific_time',
			   istime:true,
			   format: 'YYYY-MM-DD hh:mm:ss',
			})
		})
	    hy_submit('index.php?g=admin&m=chat&a={$action}','',function(result){
			var value = $("input[name='status']:checked").val();
			if(value==1){
				$("#comment_num").val(0);
			}else if(value==2){
				$("#showtime").val(0);
			}
			showMsg(result.content,result.error);
			parent.$('#adrule_{$sid}').attr('src', parent.$('#adrule_{$sid}').attr('src'));
		});
	</script>
	</body>
</html>
